<template>
    <el-card class="!border-none " shadow="never">
        <el-button type="primary" @click="propsAttackInfo">模拟打单发送消息</el-button>
        
        <popup
            v-if="showPopupRef"
            ref="popupRef"
            title="模拟打单"
            :async="true"
            width="550px"
            @confirm="handleSubmit"
            @close="showPopupRef=false"
        >
            
            <el-form ref="formRef" class="pl-3 mb-6" :model="requestBlackMail" label-width="90px" inline>
                <div class="justify-center">
                    
                    <el-form-item label="物流公司:" prop="warehouse">
                        <el-input class="w-64" v-model="requestBlackMail.logisticCompany"
                                  placeholder="请输入物流公司"></el-input>
                    </el-form-item>
                    
                    <el-form-item label="物流单号:" prop="warehouse">
                        <el-input class="w-64" v-model="requestBlackMail.logisticNumber"
                                  placeholder="请输入物流单号"></el-input>
                    </el-form-item>
                </div>
            </el-form>
            
            
        </popup>
    
    </el-card>
</template>

<script lang='ts' setup>
import Popup from "@/components/popup/index.vue";
import {UnwrapNestedRefs} from "@vue/reactivity";
import BlackmailShipping from "@/api/afterSale/warehouse/request/BlackmailShipping";
import {producers} from "@/api/system/SystemConfigService";


const popupRef = shallowRef<InstanceType<typeof Popup>>()
const showPopupRef = ref(false)


// 提交物流信息
let requestBlackMail: UnwrapNestedRefs<BlackmailShipping> = reactive(new BlackmailShipping)


/**
 * 模拟打单数据信息
 *
 * @author 徐寿春
 * 2023/5/12 09:35
 */
async function propsAttackInfo() {
    showPopupRef.value = true
    await nextTick()
    popupRef.value.open()
}


/**
 *  打单确认
 * @author 徐寿春
 * 2023/5/12 09:37
 */
function handleSubmit() {
    producers(requestBlackMail).then(()=>{
        popupRef.value.close()
    })
}




</script>
